#ifndef asnprefix_9fdebf6ede881fceadeb9fda7245fa07
#define asnprefix_9fdebf6ede881fceadeb9fda7245fa07

#include "base.h"
#include "prefix.hpp"
#include "sfhash.h"

class FlowMapKey {
    public:

    virtual size_t hash_self() const = 0;
    virtual bool equal( const FlowMapKey &) const = 0;

};

struct FlowMapKeyHash : public std::unary_function<FlowMapKey*, std::size_t> {
    std::size_t operator()(FlowMapKey* const k ) const 
    {
        return k->hash_self();
    }
};

struct FlowMapKeyEqual : binary_function <FlowMapKey*,FlowMapKey*,bool> {
    bool operator() (const FlowMapKey* x, const FlowMapKey* y) const 
    {
        return x->equal( *y );
    }
};



class AsnPrefix : public FlowMapKey {

    private:

    uint32_t asn;
    Prefix prefix;

    public:

    AsnPrefix( uint32_t _asn, Prefix _prefix ); 
    uint32_t getAsn() const; 
    Prefix getPrefix() const; 
    string str( string delimiter = " ") const;

    bool operator==( const AsnPrefix & ) const; 
    size_t hash_self() const;
    bool equal( const FlowMapKey &) const;
};


class AsnAsn : public FlowMapKey {

    private:

    uint32_t asn_src;
    uint32_t asn_dst;

    public:

    AsnAsn( uint32_t _asn_src, uint32_t _asn_dst);
    uint32_t getAsnSrc() const; 
    uint32_t getAsnDst() const; 
    string str( string delimiter) const; 
    bool operator==( const AsnAsn & rhs ) const; 

    size_t hash_self() const;
    bool equal( const FlowMapKey  &) const;

};

#endif // EOF
